<%@page import="java.net.URLDecoder"%>
<%@page import="java.net.URLEncoder"%>
<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script language="JavaScript">
	function trim(stringToTrim) {
		return stringToTrim.replace(/^\s+|\s+$/g,"");
	}
	function ltrim(stringToTrim) {
		return stringToTrim.replace(/^\s+/,"");
	}
	function rtrim(stringToTrim) {
		return stringToTrim.replace(/\s+$/,"");
	}
				function Validate()
				  {
					 
					 var title=document.getElementById("txttitle").value;
					 var desc=document.getElementById("txtdesc").value;
					 if(trim(title)==""){
						 alert("Please enter title");
						 document.getElementById("txttitle").focus();
						 return false;
					 }
					 if(trim(desc)==""){
						 alert("Please enter description");
						 document.getElementById("txtdesc").focus();
						 return false;
					 }
					 return true;
				 }	
				
</script>
</head>
<body>
<form:form modelAttribute="uploadItem" name="frm" method="post" enctype="multipart/form-data" onsubmit="return Validate();">
<table cellpadding="0" cellspacing="0" width="730" align="center" border="0" class="newsTitle" >
	<tr><td colspan="2" height="10"> </td></tr>	
	<tr align="center"><td colspan="2" height="30" style="font-size:14px;"><u>កែប្រែសេចក្តីជូនដំណឹង</u></td></tr>
	<tr><td colspan="2" height="10"> </td></tr>
	<c:forEach var="i" begin="0" end="${fn:length(Announcement)-1}">
	<tr>
		<td height="30" width="30%" align="right"​>* ចំណងជើង :&nbsp;</td>	
		<td align="left"><input type="text" id="txttitle" name="txttitle" value="${Announcement[i].ANN_TITLE}" maxlength="500" style="width: 580px; height:25px;"/></td>
	</tr>
	<tr><td colspan="2" height="10"><input type="hidden" name="txtid" id="txtid" value="${Announcement[i].ANN_ID}"></td></tr>
	<tr>
		<td align="right">* បរិយាយ :&nbsp;</td>	
		<td align="left"><textarea name="txtdesc" id="txtdesc" rows="10" style="font-size:11px;width: 580px;">${Announcement[i].ANN_DESC}</textarea></td>
	</tr>
	<tr><td colspan="2" height="10"> </td></tr>
	<tr>
		<td align="right"> ជ្រើសរើស File ថ្មី :&nbsp;</td>	
		<td align="left"><form:input path="fileData" id="txtfile" type="file" /></td>
	</tr>
	</c:forEach>
	<tr><td colspan="2" height="10"> </td></tr>
	<tr>
		<td height="5"></td>
		<td height="5" align="left" style="font-size: 10px;">* តំរូវអោយបញ្ចូល</td>
	</tr>
	<tr><td colspan="2" height="10"> </td></tr>
	<tr>
		<td colspan="2" align="center" height="30"​ style="font-size:13px;"><input type="submit" value="រក្សាទុក" class="input_button">&nbsp;&nbsp;<input class="input_button" type="button" onclick='window.location="announcement_list.html"' value="ចាកចេញ"></td>
	</tr>
	<tr><td colspan="2" height="25">&nbsp;</td></tr>
</table>
</form:form>
</body>
</html>